package com.asset.modules.common.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BasicBean {
    private static final long serialVersionUID = 1L;
    //创建人
    private Long createBy;
    //创建日期
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    //更新人
    private Long updateBy;
    //更新日期
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    //删除标识
    private Integer delFlg;

    public void preInsert(){
        this.createBy = 1l;
        this.createTime = new Date();
    }

    public void preUpdate(){
        this.updateBy = 1l;
        this.updateTime = new Date();
    }
}
